<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>activity_detail</title>
<link href="/css/global.css" rel="stylesheet" type="text/css" />
<link href="/css/index.css" rel="stylesheet" type="text/css" />
<script src="/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/js/fun.js"></script>
<script type="text/javascript">
	function commentCheck(){
		var uid = getCookie("uid");
		if(typeof(uid) == "undefined"){
			alert("please login first");
			return false;
		}
		if($("textarea[name='comment']").val() == ''){
			alert("comment not null");
			return false;
		}
		return true;
	}
</script>
</head>

<body>

<div class="headLogin">
	<p class="pLogin"></p>
	<script type="text/javascript" src="/js/login.js"></script>
</div>

<div class="header clearfix">
	<div class="logoPic"><img src="/images/pic/logo.gif" width="400" height="121" ></div>
    <div class="ivy555"><img src="/images/pic/555x121.jpg" width="555" height="121"></div>
</div>

<div class="nav">
	<a href="/index.html" >Home</a><a href="/casino.html" class="cur">Casino</a><a href="/promotions.html" >Promotions</a><a href="/players_club.html" >Player Club</a><a href="page/entertainment.html" >Entertainment</a><a href="/restaurants_lounges.html" >Restaurants & Lounges</a><a href="/index.php?r=event/showList" >Activity</a>
</div>

<div class="main">
	<div class="detail_intro">
    	<div class="mod_a">
        	<div class="th_a"><span class="sMark">{{$pageArray.row.title}}</span></div>
            <div class="tb_a">
            	<dl class="detailIntroTxt">
                    <dt>Activity time</dt>
                    <dd>{{$pageArray.row.start_time_show}} ～ {{$pageArray.row.end_time_show}}</dd>
                    <dt>Activity addresss</dt>
                    <dd>{{$pageArray.row.address}}</dd>
                    <dt>Activities Introduction</dt>
                    <dd>{{$pageArray.row.description}}</dd>
                </dl>
            </div>
        </div>

        <div class="mod_a">
        	<div class="th_a"><span class="sMark">Activities seat selection</span></div>
            <div class="tb_a">
            	<div class="seatMap">
                    <img src="{{$pageArray.row.layout}}" width="915" height="371">
                </div>
                <div class="seatList clearfix">
					{{foreach from=$pageArray.tables key=key item=item}}
					<a href="javascript:void(0)" title="{{$item.max}}座" {{if $item.ordered == '1'}}class="cur"{{else}}class="valid"{{/if}} id="{{$item.id}}" rel="{{$item.max}}">{{$item.num}}</a>
					{{/foreach}}
                </div>
				{{if $pageArray.row.show == '1'}}
				<div class="seatList clearfix">总人数：<input type="text" class="txtInput txtInputB" name="number" id="number"/></div> 
				<input type="submit" id="tb_sb" class="submitBtn submitBtnA" value="Make a Reservations Now">
				{{/if}}
            </div>
        </div>
    	
        <div class="mod_a">
        	<div class="th_a"><span class="sMark">comments</span></div>
            <div class="tb_a">
            	<div class="comment">
                    <form action="/index.php?r=comment/gen" method="post" onsubmit="return commentCheck();return false;">
                        <input type="hidden" name="eid" value="{{$pageArray.row.id}}">
						<textarea class="commentTextarea" name="comment"></textarea>
                        <input type="submit" class="submitBtn" value="submit">
                    </form>
                    <dl class="commentTxt">
						{{foreach from=$pageArray.comments key=key item=item}}
                        <dt><span class="sName">{{$item.username}}</span><span class="sTime">{{$item.addtime}}</span></dt>
                        <dd>{{$item.content}}</dd>
                        {{/foreach}}
                    </dl>
					{{include file="frontpage.tpl.htm"}}
                </div>
            </div>
        </div>
    </div>
</div>

<div class="footer">
	<p class="pLogoLinks"><a href="" class="footLogo1"></a><a href="" class="footLogo2"></a><a href="" class="footLogo3"></a><a href="" class="footLogo4"></a><a href="" class="footLogo5"></a><a href="" class="footLogo6"></a><a href="" class="footLogo7"></a><a href="" class="footLogo8"></a><a href="" class="footLogo9"></a><a href="" class="footLogo10"></a><a href="" class="footLogo11"></a><a href="" class="footLogo12"></a><a href="" class="footLogo13"></a><a href="" class="footLogo14"></a><a href="" class="footLogo15"></a></p>
    <p class="footBanner"><img src="/images/pic/footerBanner.gif" width="955" height="52"></p>
    <p class="pTxtLinks"><a href="index.html">Home</a>|<a href="casino.html">Casino</a>|<a href="promotions.html">Promotions</a>|<a href="players_club.html">Players Club</a>|<a href="entertainment.html">Entertainment</a>|<a href="restaurants_lounges.html"> Restaurants &amp; Lounges</a>|<a href="press.html">Press</a>|<a href="careers.html">Careers</a>|<a href="contact.html">Contact</a>|<a href="privacy.html">Privacy Policy</a></p>
    <p class="pCopyRight"><a target="_blank" href="https://mail.starlightcasino.ca">Copyright &copy; Gateway Casinos</a>|<em>All Rights Reserved</em>|<a target="_blank" href="http://bcresponsiblegambling.ca/">Responsible Gaming</a></p>
</div>

	<div class="mask" id="mask" style="display:none;"></div>

<div class="popWin clearfix" id="popWin" style="display:none;">
	<p class="pSuccess">恭喜你预定成功&nbsp;<span id="success"></span><br>3秒后自动跳转</p>
    <input type="submit" class="submitBtn submitBtnA" value="close" id="sub_close" onclick="javascript:location.reload();">
</div>

<div class="popWin clearfix" id="popWinA" style="display:none;">
	<dl class="cardCon clearfix" id="dl_card">
    </dl>
    <input type="submit" class="submitBtn submitBtnA" value="submit" id="sub_card">
</div>

<script>
var popWinID = document.getElementById("popWin"),popWinIDa = document.getElementById("popWinA"),maskID = document.getElementById("mask");
var scrollTop,winHeight = document.body.scrollHeight,popWinHeight = popWinID.offsetHeight,popWinHeightA = popWinIDa.offsetHeight;
maskID.style.height = winHeight + "px";
popWinID.style.marginTop = - popWinHeight/2 + "px";
popWinIDa.style.marginTop = - popWinHeightA/2 + "px";

var isIE6= !!window.ActiveXObject&&!window.XMLHttpRequest;

if(isIE6){
	var showHeight = document.documentElement.clientHeight;
	function doScroll(){
		scrollTop=document.documentElement.scrollTop+document.body.scrollTop;
		popWinID.style.top = scrollTop + showHeight/2 + "px";
		popWinIDa.style.top = scrollTop + showHeight/2 + "px";
	}
	
	window.onscroll = doScroll;
}
</script>
<script type="text/javascript" src="/js/reservation.js"></script>
<script type="text/javascript">
	var vip = '{{$pageArray.row.type}}';
	var n_encorecard = '{{$pageArray.row.n_encorecard}}';
	var n_creditcard = '{{$pageArray.row.n_creditcard}}';
	var min = '{{$pageArray.row.min}}';
	var eid = '{{$pageArray.row.id}}';
	var mirros = '{{$pageArray.row.minors}}';
	var timeout = null;
	
	$(document).ready(function(){
		$(".seatList").find(".valid").each(function(){
			$(this).click(function(){
				if($("#number").val() == "" || isNaN($("#number").val())){
					alert("请先填写预约人数");
					$(this).focus();
					return false;
				}
				if($(this).hasClass("selected")){
					$(this).removeClass("selected");
				}else{
					$(this).addClass("selected");
				}
			});
		});
		
		$("#number").blur(function(){
			var number  = parseInt($("#number").val(), 10);
			if($("#number").val() == "" || isNaN($("#number").val())){
				alert("预约人数须大于0");
				$(this).focus();
				return false;
			}else{
				$(".seatList").find(".valid").each(function(){
					if(number >0 && number <= 2){
						tableSelect(2);
					}else if(number > 2 && number <= 4){
						tableSelect(4);
					}else if(number > 4 && number <=6){
						tableSelect(6);
					}
					else{
						tableSelect('all');
					}
				});
			}
		});
		
		$("#tb_sb").click(function(){
			if(typeof(getCookie("username")) == "undefined" || typeof(getCookie("uid")) == "undefined"){
				alert("please login");
				return false;
			}
			if($("#number").val() == "" || isNaN($("#number").val())){
				alert("预约人数须大于0");
				$(this).focus();
				return false;
			}
			
			Reservation.checkVipCard();
		});
		
		$("#sub_card").click(function(){
			var commit = 1;
			$("#dl_card input").each(function(){
				if($(this).val() == ""){
					alert("card number not null");
					commit = 0;
					return false;
				}
			});
			if(commit == 1){
				var parameter = "eid=" + eid + "&";
				if($("#encorecard").length > 0){
					parameter += "encorecard=" + $("#encorecard").val() + "&";
				}
				if($("#creditcard").length > 0){
					parameter += "creditcard=" + $("#creditcard").val() + "&";
				}
				parameter = parameter.substring(0, parameter.length -1);
				$.ajax({
					type : "get",
					url : "/index.php?r=user/checkCard&" + parameter + "&timestamp=" + new Date().getTime(),
					success : function(msg){
						if(msg == "success"){
							$("#mask").hide();
							$("#popWinA").hide();
							Reservation.tableSubmit();
						}else{
							alert(msg);
							return  false;
						}
					}
				});
			}else{
				return false;
			}
		});
	});
	
	function tableSelect(max){
		$(".seatList").find(".valid").each(function(){
			if(max == 'all'){
				$(this).removeClass("selected").addClass("cur").click(function(){
					return false;
				});
			}else{
				if($(this).attr("rel") > max){ //只要桌子的最大座位数小于 预订总人数 都显示出来
					$(this).removeClass("selected").addClass("cur").click(function(){
						return false;
					});
				}else{
					$(this).removeClass("cur").click(function(){
						if($(this).hasClass("selected")){
							$(this).removeClass("selected");
						}else{
							$(this).addClass("selected");
						}
					});
				}
			}
		});
	}
</script>
</body>
</html>
